# 定义普通函数
def cube(x):
    return x ** 3


print(cube(3))

# 定义Lambda函数
l = lambda x: x ** 3
print(l(4))
print(l(5))

# 高级写法
# filter():过滤
li = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
data = list(filter(lambda x: (x % 2 != 0), li))
print(data)

# 常用的做法
data2 = []
for i in li:
    if i % 2 != 0:
        data2.append(i)
print(data2)


